//boolean keyAct; //<>//
boolean displayAct;
boolean keyCommand;
boolean setEchoAddress;

void keyPressed() {
  //  keyAct=true;
  if (keyCommand) {

    if (setEchoAddress && (key >= '0' && key <= '9'))
    {
      if (padIP.length() < 3) {
        padIP+=key;
      }
      if (padIP.length()==3) {
        setEchoAddress = false;
        keyCommand=false;
        OSCInit();
      }
    }
    switch(key) {

    case '1':
    case '2':
    case '3':
    case '4':
    case '5':
    case '6':
    case '7':
    case '8':
    case '9':
    case '0':
      break;
    case 'a': //set echo address
      setEchoAddress=true;
      padIP="";
      break;
    case 's': //stop
      sFacetStop();
      keyCommand=false;
      break;
    case ENTER:
    keyCommand=false;
    OSCInit();
      break;

    default:    
      keyCommand=false; 
      break;
    }
    key=' ';
  }
  switch(key) {
  case '>': //inSpin ("spinUp" 72)
    goMode=1;
    oscEcho(6, 3, 8); //actually, 72
    break;
  case '`': //extra key command mode
    println("keycommmand");
    keyCommand=true;
    break;
  case '/': //test input
    testInput();    
    break;
  case '?': // test2
    testInput2();
    break;
  case '\\':
    oscEcho(0, 0, 0);
    break;
  case '|':
    PadSetup();
    break;
  case'a':
  case'b':
  case'c':
  case'd':
  case'e':
  case'f':
  case'g':
  case'h':
  case'i':
  case'j':
  case'k':
  case'l':
  case'm':
  case'n':
  case'o':
  case'p':
    inFlower(int(key)-97); //'a' flower must equal zero
    break;
  case'A':
  case'B':
  case'C':
  case'D':
  case'E':
  case'F':
  case'G':
  case'H':
  case'I':
  case'J':
  case'K':
  case'L':
  case'M':
  case'N':
  case'O':
  case'P':
    inPSelect(int(key)-64); //button 1=1
    break;
  case ENTER:
    GoLaunch(true);
    break;
  default:
    println("key= "+key);
    break;
  }
  //  displayAct=true;
  //  keyAct=false;
}

void testInput() {
  println("test input routines begun");
  goMode=3;
  UpdateSeed(0, 32768);
  UpdateSeed(1, 5);
  GoLaunch(true);
}
void testInput2() {
  println("test input routines begun");
  goMode=1;
}

